ProDOS Dating
By Grant Kwai
Copyright (c) 1991 Apple Users' Group, Sydney
Republished from Applecations, a publication of the Apple Users' Group, Sydney, Australia.
<NO DATE> 00:00
Do you just hate seeing that appear when you catalog your disk, especially if it is your personal program you wrote which is displaying it? To quell your nerves, I have a solution!
Most (few?) people like me, do not have a clock card in their Apple // machine (//gs users excluded). This, readers, means no date stamping when you save a program to disk.
What this small program does is allow you to manually set the date and time, so that ProDOS will use it when it comes time to save a file onto disk. How it does this is by POKEing a value into the Disk Operating System (DOS) locations, where ProDOS would look for the time.
Its resourcefulness
-------------------
What are the advantages to this program? For one, you can now set the time and date on your own programs, or programs which you are saving to disk/s. All you have to do is run the Date/time program once. Then it will stay intact until you turn the machine off, hit <Reset>, or some other program 'clobbers' the locations it uses. After running the date/time program, simply go about loading, modifying, saving, etc. your normal program. It will be automatically stamped with the data you specified.
Another use is as a startup program or launcher. I find that many programs, especially utility programs (e.g. Shrinkit) allow you to copy files and the likes, but have no option to set the time. If you make the date/time program the first program executed on bootup, then each time you boot the disk, you can set the date and time.
To do this, you will possibly need to put a copy of BASIC.SYSTEM on the disk to be modified. The reason is that you need to run a BASIC program. What BASIC.SYSTEM does is search for the filename STARTUP. If it is found, it will try to run it. What you need to do is rename the date/time program to STARTUP. Additionally, where the below program would END, you would need to modify this to launch the actual program you want to run. E.g. In order to load to Shrinkit after setting the date and time then change line 1001 to read: '1001 PRINT CHR$(4);"-SHRINKIT.SYSTEM" '.
Requirements
------------
This program can ONLY be run under ProDOS and not DOS 3.3. The reason is that DOS 3.3 does not have date/time stamping capabilities. For the below program, you will also need an 80 column card and mousetext capabilities. However, these last two requirements only hold true if you type my program out 'word for word'. There is nothing stopping you from changing the output to a 40 column screen and eliminating the mousetext part of the program.
Program listing
---------------
10 PRINT CHR$(4);"PR#3": ONERR GOTO 1000
20 PRINT SPC(25);"-----------------------"
21 PRINT SPC(25);"-Date-Time Set program-"
22 PRINT SPC(25);"- Created By -"
23 PRINT SPC(25);"- -"
24 PRINT SPC(25);"- Grant Kwai -"
25 PRINT SPC(25);"- ~~~~~~~~~~ -"
26 PRINT SPC(25);"- Ver 2.0 -"
27 PRINT SPC(25);"- October 1990 -"
28 PRINT SPC(25);"-----------------------"
30 PRINT : HTAB 15:PRINT "Enter Date in the form (31/10/89) -Aust. form"
40 PRINT : INPUT "Enter Day (DD): ";DD
41 PRINT : INPUT "Enter Month (MM): ";MM
42 PRINT : INPUT "Enter Year (YY): ";YY
50 POKE 49041,2 * YY + (MM>7))
60 POKE 49040,DD + 32 * (MM- 8 * (MM > 7)) : PRINT
70 PRINT : PRINT "Enter the time in 24hour style (23:46)"
80 PRINT : INPUT "The Hour (HH): ";HH: IF HR = > 25 THEN GOTO 300
90 INPUT "The minutes (MN): ";MN: IF MN = > 60 THEN GOTO 300
100 POKE 49043,HR
110 POKE 49042,MN
120 HOME
130 GOSUB 500
140 GOSUB 600
150 PRINT : HTAB 6 :PRINT "Date set is ";DD;"-"MM;"-"YY;: HTAB 48 : PRINT "Current Time set is "HR;":"MN : PRINT
160 GOSUB 500
170 GOSUB 600
180 PRINT : HTAB 30 : PRINT "Is this correct? ";: GET X$
190 IF X$= "N" OR X$ = "n" THEN GOTO 10
200 GOTO 1001
300 REM On range error
310 LET G$= CHR$(7): PRINT G$: PRINT G$ : HOME : GOTO 70
500 REM Turn on mouse characters
510 PRINT CHR$(15);CHR$(27);: FOR X=1 TO 80 : PRINT "A";: NEXT X
520 RETURN
600 REM Turn off mouse characters
610 PRINT CHR$(14);CHR$(27);
620 RETURN
1000 GOTO 10
1001 END
End of Listing.
Synopsis
--------
- An ONERR GOTO statement simply catches any potential syntax errors and directs it to line 1000
- Lines 10-28 prints 25 spaces then data in quote marks.
- Lines 40-42 INPUT the day, month and year from user.
- Lines 50-60 POKE in the year(YY), Month(MM) and day(DD) data.
- Lines 80-90 INPUT the hour and the minutes.
- lines 100-110 POKE in the Hour(HH) and Minutes(MN) data.
- GOSUB tells the computer to GO to a SUBroutine.
- Line 310 gives two beeps on th time range error(eg entering 26 hours etc). returns user to input data again.
- Line 510 turns on mousetext characters, displays 80 open apples.
- RETURN tells the computer to RETURN from a subroutine. Program control goes back to where the GOSUB was executed.
- Line 610 Turns off mousetext characters.
- Line 1000 is the 'catch basin' for the ONERR statement. When reached, it directs the program to go back to line 10 and restart.
- Line 1001 ENDs program.
Further Modifications
---------------------
Here are some other modifications which you can try yourself:
Check to see if the date and time has been set previously, if so then exit.
If you make the date/time program your 'launcher' (as described above), you may like a 'quick exit' routine so that you do not have to enter the date and time (e.g. you just want to run a particular program). To do this, at the beginning of the program, make a little modification to GET a character. If that character is, say the escape key, exit and launch the main program.
Final note
----------
For modem owners, this program can be downloaded from the AUG Apple // BBS. If you absolutely must have the time then a clock chip can be obtained directly from the Apple Users' Group (Sydney). Look for the Bulk Purchase section at the back of the magazine.

THIS CONTENT COPYRIGHT © 2007, APPLE MACINTOSH USERS' GROUP, SYDNEY
Permission has been obtained to make this material available on the Internet.

Permission is hereby granted for non-profit user groups to republish this content.
PLEASE CREDIT THE AUTHOR AND THE SOURCE: Applecations, publication of the Apple Users' Group, Sydney, Australia

THIS PAGE COPYRIGHT © 2007, ANDREW ROUGHAN